package com.bt.dmdb.model;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "ODS_PROJECT_SITE")
@SuppressWarnings("serial")
public class ProjectSite implements java.io.Serializable {

    private BigDecimal id;
    private Site site;
    private User user;
    private Project project;
    private Character priorityFlag;
    private Date crd;
    private String crdChangedBy;
    private String crdChangeReason;
    private Set<PropSiteMilestone> propSiteMilestones = new HashSet<PropSiteMilestone>(0);
    private Set<PropSite> propSites = new HashSet<PropSite>(0);

    public ProjectSite() {
    }

    public ProjectSite(BigDecimal id) {
        this.id = id;
    }

    public ProjectSite(BigDecimal id, Site site, User user, Project project, Character priorityFlag, Date crd, String crdChangedBy, String crdChangeReason, Set<PropSiteMilestone> propSiteMilestones, Set<PropSite> propSites) {
        this.id = id;
        this.site = site;
        this.user = user;
        this.project = project;
        this.priorityFlag = priorityFlag;
        this.crd = crd;
        this.crdChangedBy = crdChangedBy;
        this.crdChangeReason = crdChangeReason;
        this.propSiteMilestones = propSiteMilestones;
        this.propSites = propSites;
    }

    @Id
    @Column(name = "ID", unique = true, nullable = false, scale = 0)
    public BigDecimal getId() {
        return this.id;
    }

    public void setId(BigDecimal id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SITE_ID")
    public Site getSite() {
        return this.site;
    }

    public void setSite(Site site) {
        this.site = site;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "USER_ID")
    public User getUser() {
        return this.user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PROJECT_ID")
    public Project getProject() {
        return this.project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    @Column(name = "PRIORITY_FLAG", length = 1)
    public Character getPriorityFlag() {
        return this.priorityFlag;
    }

    public void setPriorityFlag(Character priorityFlag) {
        this.priorityFlag = priorityFlag;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "CRD", length = 7)
    public Date getCrd() {
        return this.crd;
    }

    public void setCrd(Date crd) {
        this.crd = crd;
    }

    @Column(name = "CRD_CHANGED_BY", length = 50)
    public String getCrdChangedBy() {
        return this.crdChangedBy;
    }

    public void setCrdChangedBy(String crdChangedBy) {
        this.crdChangedBy = crdChangedBy;
    }

    @Column(name = "CRD_CHANGE_REASON", length = 500)
    public String getCrdChangeReason() {
        return this.crdChangeReason;
    }

    public void setCrdChangeReason(String crdChangeReason) {
        this.crdChangeReason = crdChangeReason;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "projectSite")
    public Set<PropSiteMilestone> getPropSiteMilestones() {
        return this.propSiteMilestones;
    }

    public void setPropSiteMilestones(Set<PropSiteMilestone> propSiteMilestones) {
        this.propSiteMilestones = propSiteMilestones;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "projectSite")
    public Set<PropSite> getPropSites() {
        return this.propSites;
    }

    public void setPropSites(Set<PropSite> propSites) {
        this.propSites = propSites;
    }
}
